import axios from 'axios';
import config from '@/../src/config/index';

const defaultWmsUrl = process.env.NODE_ENV === 'development'
    ? config.wmsUrl.dev
    : process.env.VUE_APP_MODE === 'testEnvironment'
        ? config.wmsUrl.dev
        :  process.env.VUE_APP_MODE === 'temporary'
            ? config.wmsUrl.temporary
            :  process.env.VUE_APP_MODE === 'prod'
                ? config.wmsUrl.pro
                : config.wmsUrl.dev;
// 分色客户
export function getSepPlanDtails(data,wmsUrl= defaultWmsUrl) {
  return axios({
    // url:  wmsUrl + '/api/ccis_separation_apply/selectByOrderNum',
    url:  wmsUrl  + '/api/ccis_separation_apply/lenglianSelectDetailByOrderNum',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}
// 分色客户删除/api/ccis_separation_apply/submit
export function deleteSepPlanDtails(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url:  wmsUrl  + '/api/ccis_separation_apply/removeByOrderNum',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}
// 分色客户
export function submitSepPlanDtails(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url:  wmsUrl  + '/api/ccis_separation_apply/submit',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}

// 获取货物规格
export function getGoodsInfo(data, wmsUrl= defaultWmsUrl) {
  return axios({
      url: wmsUrl  + '/api/wms_pack/selectPackInfo',
      method: 'post',
      parameter: {
        type: 'WMS'
      },
      data
  });
}

// 分色更新
export function updataSepPlanInfo(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/ccis_separation_apply/updateApplyAndApplyDetail',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}
// 天津新增
export function createApplyAndApplyDetail(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/ccis_separation_apply/createApplyAndApplyDetail',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}

// 天津编辑
export function updateApplyAndApplyDetail(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/ccis_separation_apply/updateApplyAndApplyDetail',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}
// 天津编辑
export function lenglianSelectDetailByOrderNum(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/ccis_separation_apply/lenglianSelectDetailByOrderNum',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}
// 进度详情
export function getBusinessprogress(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/plan_summary/getBusinessprogress',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}

export function addIntoMaterialData(data,wmsUrl= defaultWmsUrl) {
  return axios({
    url: wmsUrl  + '/api/wms_material/addIntoMaterialData',
    method: 'POST',
    parameter: {
      type: 'WMS'
    },
    data
  })
}